package chapter02;

import java.util.Scanner;

/**
 * 通过异或运算符"^"，可以实现两个变量不再借助第三方变量的以实现两个变量不再借助第三方变量清空下完成互换，好处：高效;
 * Created by a on 2017/6/8.
 */
public class Test027 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字:");
        long A = scanner.nextLong();
        System.out.println("请输入一个数字");
        long B = scanner.nextLong();
        System.out.println("A="+A+"\tB="+B);
        A=A^B;
        B=A^B;
        A=A^B;
        System.out.println("A="+A+"\tB="+B);
    }

}
